package com.tencent.wxcloudrun.controller;


import com.tencent.wxcloudrun.common.Result;
import com.tencent.wxcloudrun.dtos.req.IdReqDTO;
import com.tencent.wxcloudrun.dtos.req.JobsAddReq;
import com.tencent.wxcloudrun.dtos.req.PageReqDTO;
import com.tencent.wxcloudrun.dtos.resp.JobsResp;
import com.tencent.wxcloudrun.service.JobsService;
import com.tencent.wxcloudrun.vos.PageVO;
//import io.swagger.v3.oas.annotations.Operation;
//import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * 工作表(目前针对兼职字段未详细划分)(Jobs)表控制层
 */
@Slf4j
@RestController
@RequestMapping("/api/v1/obs/")
//@Tag(name = "工作控制器")
public class JobsController extends BaseController{
    /**
     * 服务对象
     */
    @Resource
    private JobsService jobsService;

//    @Operation(summary = "获取已发布的数据")
    @PostMapping("releasePage")
    public Result<PageVO<JobsResp>> getPageForRelease(@Valid @RequestBody PageReqDTO pageReqDTO){
        return jobsService.getPageForRelease(pageReqDTO);
    }

//    @Operation(summary = "获取所有数据(包括待审核)")
    @PostMapping("page")
    public Result<PageVO<JobsResp>> getPage(@Valid @RequestBody PageReqDTO pageReqDTO){
        return jobsService.getPage(pageReqDTO);
    }

//    @Operation(summary = "新增工作")
    @PostMapping("add")
    public Result<Object> addJob(@Valid @RequestBody JobsAddReq req) {
        return jobsService.addJob(req);
    }

//    @Operation(summary = "通过")
    @PostMapping("pass")
    public Result<Object> pass(@Valid @RequestBody IdReqDTO req) {
        return jobsService.updateJobState(req.getId(), 1);
    }

//    @Operation(summary = "拒绝")
    @PostMapping("reject")
    public Result<Object> reject(@Valid @RequestBody IdReqDTO req) {
        return jobsService.updateJobState(req.getId(),  2);
    }


}

